#include <REGX52.H>


sbit HC138_C=P2^7;
sbit HC138_B=P2^6;
sbit HC138_A=P2^5;
sbit S7 = P3^0;
sbit S6 = P3^1;
sbit S5 = P3^2;
sbit S4 = P3^3;
void Delay(unsigned int t)
{
	while(t--);
	while(t--);
}
void Running()
{
	unsigned int i;
	HC138_C=1;
	HC138_B=0;
	HC138_A=0;
	if(S4==0||S5==0||S6==0||S7==0)
	{
		Delay(10);
		if(S4==0)
		{
			for(i=0;i<3;i++)
			{
				P0=0x00;
				Delay(60000);
				P0=0xff;
				Delay(60000);
			}
		}
		if(S5==0)
		{
			for(i=1;i<=8;i++)
			{
				P0=0xff << i;
				Delay(60000);
			}
		}
	}
	if(S6==0)
	{
		for(i=1;i<=8;i++)
		{
			P0=~(0xff << i);
			Delay(60000);
		}
	}

}
void main()
{
	while(1)
	{
		Running();
	}
}
